

package com.googlecode.flac4j.format.frame.sub;


import com.googlecode.jinahya.util.BitAccessible;



import javax.xml.bind.annotation.XmlTransient;


/**
 *
 * @author Jin Kwon <jinahya at gmail.com>
 */
public abstract class Rice implements BitAccessible {


    /**
     * Returns the target residual coding method.
     *
     * @return target residual coding method.
     */
    public abstract int getResidualMethod();


    // --------------------------------------------------------- parent Residual
    /**
     * Returns the parent residual of this rice.
     *
     * @return parent residual
     */
    public final Residual getResidual() {
        return parent;
    }


    /**
     * Sets the parent residual of this rice.
     *
     * @param parent parent residual
     */
    public final void setResidual(final Residual parent) {
        if (parent == null) {
            throw new NullPointerException("null residual");
        }

        this.parent = parent;
    }

    // ------------------------------------------------------------------- order

    /**
     * Returns order.
     *
     * @return order
     */
    public abstract int getOrder();


    /**
     * Sets order.
     * 
     * @param order order
     */
    public abstract void setOrder(int order);


    /** parent residual. */
    @XmlTransient
    private Residual parent;


}

